import time


def my_decorator(func):
    def wrapper():
        start_time = time.time()
        print("before")
        func()
        print("after")
        print(f"共消耗{time.time()-start_time}")

    return wrapper


@my_decorator
def hello():
    print("hello")


hello()
